package com.fishingwithme.infrastructure.dtos;

import com.fishingwithme.domain.common.Location;
import cn.fishingwithme.domain.spots.*;
import com.fishingwithme.domain.spots.*;
import com.fishingwithme.infrastructure.utils.CommonUtils;
import lombok.Data;

import java.util.List;

@Data
public class SpotDto {
    private Long id;
    private Long circleId;
    private String name;

    private Location location;

    private List<Location> line;

    private List<String> pics;

    private List<SpotType> spotTypes;

    private List<FishType> fishTypes;

    private Boolean isFree;

    private Boolean parkingEasy;

    private SpotLvl lvl;

    private ParkingDistance distance;

    private Boolean secret;

    private WaterType waterType;

    private String description;

    public static SpotDto toDto(Spot spot) {
        SpotDto dto = new SpotDto();
        dto.setId(spot.getId());
        dto.setName(spot.getName());

        dto.setLocation(new Location(spot.getLatitude(), spot.getLongitude()));
        dto.setLine(CommonUtils.convert(spot.getNavLine(), Location.class));
        dto.setPics(CommonUtils.convert(spot.getPictures(), String.class));
        dto.setSpotTypes(CommonUtils.convert(spot.getSpotTypes(), SpotType.class));
        dto.setFishTypes(CommonUtils.convert(spot.getFishTypes(), FishType.class));

        dto.setIsFree(spot.getIsFree());
        dto.setParkingEasy(spot.getIsParkingConvenient());
        dto.setLvl(spot.getLvl());
        dto.setDistance(spot.getDistance());
        dto.setSecret(spot.getIsPrivate());
        dto.setWaterType(spot.getWaterType());
        dto.setDescription(spot.getDescription());
        return dto;

    }
}
